package com.diaohw.platform.framework.db.flex.obj.model;

import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.core.keygen.KeyGenerators;
import lombok.Data;
import lombok.experimental.Accessors;

import java.time.LocalDateTime;

/**
 * @author 刁海文
 * @Remark 公用基础model 包含创建和修改
 * @ignore
 * @since 2023/6/27 21:29
 */
@Data
@Accessors(chain = true)
public class BaseModel {
    /**
     * 主键ID
     */
    @Id(value = KeyGenerators.snowFlakeId, keyType = KeyType.Generator)
    @Column("id")
    private String id;

    /**
     * 创建时间
     */
    @Column(value = "CREATED_TIME")
    private LocalDateTime createdTime;

    /**
     * 修改时间
     */
    @Column(value = "UPDATED_TIME")
    private LocalDateTime updatedTime;

    /**
     * 创建人
     */
    @Column(value = "created_by")
    private String createdBy;

    /**
     * 更新人
     */
    @Column(value = "updated_by")
    private String updatedBy;

    public void clear() {
        this.createdTime = null;
        this.updatedTime = null;
        this.createdBy = null;
        this.updatedBy = null;
        this.id = null;
    }
}
